<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<body>
<div th:fragment="res">
    <!-- 新 Bootstrap4 核心 CSS 文件 -->
    <link rel="stylesheet" href="/css/bootstrap.min.css">

    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="/js/jquery.min.js"></script>

    <!-- 最新的 Bootstrap4 核心 JavaScript 文件 -->
    <script src="/js/bootstrap.min.js"></script>
    <!-- popper.min.js 用于弹窗、提示、下拉菜单 -->
    <script src="/js/popper.min.js"></script>
</div>
<div th:fragment="header-nav">
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <a class="navbar-brand" href="#">在线答疑系统</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item active">
                    <a class="nav-link" href="/index/">首页 <span class="sr-only">(current)</span></a>
                </li>
                <div sec:authorize="hasAuthority('admin')">
                    <li class="nav-item" sec:authorize="hasAuthority('admin')">
                        <a class="nav-link" href="/admin">用户管理</a>
                    </li>
                </div>

            </ul>
            <div class="my-lg-0">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            欢迎<span sec:authentication="name"></span>
                        </a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item" href="/info">个人信息</a>
                            <a class="dropdown-item" href="/modifypwd">修改密码</a>
                            <div class="dropdown-divider"></div>
                            <a class="dropdown-item" href="/logout">注销</a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</div>
</body>
</html>